package com.yuntsg.nnsfcp.front.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yuntsg.nnsfcp.front.entity.OrderBaseInfo;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 查收,查新,查引---> 填写委托单--> 委托信息
 * 这个表也作为核心表进行后台审核用的，添加几个字段
 * Mapper 接口
 * </p>
 *
 * @author gcr
 * @since 2023-06-14
 */
public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfo> {

    @Select("SELECT type,COUNT(*) as num FROM order_base_info GROUP BY type")
    List<Map<String, Object>> getSA();


    @Select("SELECT type,COUNT(*) as num FROM order_base_info where addtime>= #{startTime} and endtime<= #{endTime} GROUP BY type")
    List<Map<String, Object>> getSAwhithDate(String startTime, String endTime);


    @Select("SELECT gy_id,COUNT(*) as num  FROM order_base_info  WHERE addtime>= #{startTime} and addtime<= #{endTime}  and type = #{type} and gy_id is not null  GROUP  BY  gy_id ")
        //查看馆员任务量
    List<Map> getSAWithTypebyGy(Integer type, String startTime, String endTime);


    @Select("SELECT sh_id,COUNT(*) as num  FROM order_base_info " +
            " WHERE addtime>= #{startTime} and addtime<= #{endTime} and " +
            "type = #{type} and sh_id is not null   GROUP  BY  sh_id ")
        //查看审核员任务量
    List<Map> getSAWithTypeByShenhe(Integer type, String startTime, String endTime);


}
